package com.yc.spring.bean;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.List;

@Data
public class HelloBean {

    private String name;
    private int age;
    private char gender;
    private List<String> friends;

    private Color color;

    public HelloBean() {
    }

    public HelloBean(String name, int age){
        this.name = name;
        this.age = age;
    }

    public HelloBean(int age, String name){
        this.name = name + " OK";
        this.age = age + 10;
    }

    public HelloBean(String name, int age, char gender){
        this.name = name;
        this.age = age;
        this.gender = gender;
    }

    public void sayHello(){
        System.out.println("你好,中国");
    }

    @PostConstruct // init-method
    public void init(){
        System.out.println("========init========");
    }

    @PreDestroy   // destroy-method
    public void destroy(){
        System.out.println("========destroy========");
    }

}
